<span class="glyphicon glyphicon-map-marker" aria-hidden="true">
    <span>系统</span> /
    <span>资讯中心</span> /
    <span>资讯列表</span>
</span>
<div style="width: 100%;margin-top: 20px;">
    <a href="{:url('admin/News/Add')}" class="ncap-btn-big ncap-btn-green"
       style="background-color: #00a0e9;">添加</a>
    <div class="table-responsive" style="border:0px solid #fff;">

        <div class="layui-tab layui-tab-card" style="width:100%;">

            <ul class="layui-tab-title">
                <li onclick="query(0)" style="width: 50%;" {if condition="$member_id == 0"}
                    class="layui-this" {/if}>平台发布</li>
                <li onclick="query(1)" style="width: 50%;" {if condition="$member_id == 1"}
                    class="layui-this" {/if}>用户分享</li>
                </ul>
            <div class="layui-tab-content" style="height: auto;">

                <div class="layui-tab-item layui-show">

                    <table class="table"  border="1" width="100%" style="margin: 10px 0px;">
                        <tr>
                            <td width="20%" style="vertical-align: middle;">文章资讯标题</td>
                            <td width="12%" style="vertical-align: middle;">文章类型</td>
                            <td width="12%" style="vertical-align: middle;">作者</td>
                            <td width="15%" style="vertical-align: middle;">文章资讯图片</td>
                            <td width="18%" style="vertical-align: middle;">发布时间</td>
                            <td width="9%" style="vertical-align: middle;">阅读次数</td>
                            {php} if($member_id == 0) { {/php}
                            <td style="vertical-align: middle;">操作</td>
                            {php}  } {/php}
                        </tr>
                        {volist name="list" id="vo"}
                        <tr>
                            <td style="vertical-align: middle;">{$vo.title}</td>
                            <td style="vertical-align: middle;">{$vo.NewsByType.title}</td>
                            <td style="vertical-align: middle;">{$vo.author}</td>
                            <td style="vertical-align: middle;">
                                {if condition="$vo.UploadLogo"}
                                <img src="__IMG__{$vo.UploadLogo.path}" style="max-width: 200px;max-height: 40px;"
                                     data-target="#modal" data-toggle="modal"
                                     onclick="getPicture('{$vo.logo}')" />
                                {/if}
                            </td>
                            <td style="vertical-align: middle;">{$vo.create_time}</td>
                            <td style="vertical-align: middle;">{$vo.click}次</td>
                            {php} if($member_id == 0) { {/php}
                            <td style="vertical-align: middle;">
                                <a href="{:url('Admin/news/edit',array('id' => $vo.id))}" class="ncap-btn-big ncap-btn-green"
                                   style="background-color: #00a0e9;">编辑</a>
                                <a href="javascript:NewsDelete({$vo.id})" class="ncap-btn-big ncap-btn-green"
                                   style="background-color: red;">删除</a>
                            </td>
                            {php} } {/php}
                        </tr>
                        {/volist}
                    </table>


                    <div class="pagination">
                        {$list -> render();}
                    </div>

                </div>
            </div>

        </div>

    </div>
</div>
<script type="text/javascript">
    function query(member_id){
        window.location.href = "{:url('admin/news/index')}?member_id="+member_id;
    }
    //删除
    function NewsDelete(id) {
        layer.confirm('请确认是否删除', {
            icon: 3,btn: ['确认','取消'] //按钮
        }, function(){
            $.ajax({
                type:"post",
                url:"{:url('admin/News/delete')}",
                data:{
                    "id":id
                },
                success:function (res) {
                    title(res);
                    setTimeout('location_href()',1500);
                }
            });
        }, function () {
            title('取消操作');
        });
    }
</script>